package idiet.service;

import java.util.List;

import idiet.bean.CustomerPal;
import idiet.dao.hibernate.CustomerPalDao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository("customerPalService")
public class CustomerPalService {
	@Autowired
	CustomerPalDao customerPalDao;
	public CustomerPal getCustomerPalById(int palId){
		return this.customerPalDao.getCustomerPalById(palId);
	}
	public List<CustomerPal> getCustomerPalsByCustomerPalName(String customerPalName){
		if(customerPalName==null){
			return this.customerPalDao.getCustomerPals();
		}else{
			return this.customerPalDao.getCustomerPalsByCustomerPalName(customerPalName);
		}
	}
	public void createCustomerPal(CustomerPal pal){
		this.customerPalDao.createCustomerPal(pal);
	}
	public void updateCustomerPal(CustomerPal pal){
		this.customerPalDao.updateCustomerPal(pal);
	}
	public void deleteCustomerPal(CustomerPal pal){
		this.customerPalDao.deleteCustomerPal(pal);
	}
}
